package com.iwhalecloud.bss.kite.cucc.service.attr.linkhandler;

import com.iwhalecloud.bss.kite.cucc.service.attr.LocalAttrHelper;
import com.iwhalecloud.bss.kite.cucc.service.attr.handler.ISChannelWordsAttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.impl.AbstractAttrLinkageHandler;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Service;

/**
 * @author 柳永辉
 * @Date 2021/04/08
 *
 * 使用渠道选择普通短息是，展示且必填
 * 使用渠道选择普通短信+数字短信时，展示且必填
 *
 *（智慧信息）
 * 短信套餐费用
 * 短信套餐费用（数字）
 * (三网信息)
 * 短信单价(元/条)（三网数字） 200001174
 * 短信单价(元/条)（三网） 200001175
 * 套餐内短信条数（三网数字） 200001176
 * 套餐内短信条数（三网）200001177
 * 短信套餐费用（三网数字）200001178
 * 短信套餐费用（三网）200001179
 */

@Service
@Import(ISChannelWordsAttrHandler.class)
public class ISChannelWordsAttrLinkHandler extends AbstractAttrLinkageHandler<AttrData> {

    @Override
    public void handle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {
        //获取使用渠道属性值
        KiteAttr enterPriseSelfPurchaseAttr = kiteInst.getAttr("200001097");
        if("2021033116".equals(enterPriseSelfPurchaseAttr.getValue())){
            LocalAttrHelper.showAndNotNull(kiteInst, "200001099");
            LocalAttrHelper.showAndNotNull(kiteInst, "200001167");
            LocalAttrHelper.showAndNotNull(kiteInst, "200001174");
            LocalAttrHelper.showAndNotNull(kiteInst, "200001175");
            LocalAttrHelper.showAndNotNull(kiteInst, "200001176");
            LocalAttrHelper.showAndNotNull(kiteInst, "200001177");
            LocalAttrHelper.showAndNotNull(kiteInst, "200001178");
            LocalAttrHelper.showAndNotNull(kiteInst, "200001179");
        }else{
            LocalAttrHelper.hideAndNullable(kiteInst, "200001099");
            LocalAttrHelper.hideAndNullable(kiteInst, "200001167");
            LocalAttrHelper.hideAndNullable(kiteInst, "200001174");
            LocalAttrHelper.hideAndNullable(kiteInst, "200001175");
            LocalAttrHelper.hideAndNullable(kiteInst, "200001176");
            LocalAttrHelper.hideAndNullable(kiteInst, "200001177");
            LocalAttrHelper.hideAndNullable(kiteInst, "200001178");
            LocalAttrHelper.hideAndNullable(kiteInst, "200001179");
        }
    }

    @Override
    public void handleStyle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {

    }
}
